﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RayDen.Library.Components.Surface;
using RayDen.Library.Core.Primitives;
using RayDen.Library.Entity.Scene;

namespace BsdfDevelopment
{
    public class BsdfEdit
    {
        public SurfaceMaterial ObjectMaterial;
        public SurfaceMaterial PlaneMaterial;



        public BsdfEdit()
        {
            Init();
        }

        private void Init()
        {
            var materialInfo = new MaterialInfo()
                {
                    Name = "object_materialview_test",
                    DiffuseReflectance =  new RgbSpectrum(0.6f), GlossReflectance = new RgbSpectrum(0f, 0.45f, 0.65f), PhongExponent = 50f,SpecularReflectance = new RgbSpectrum(0.75f),
                    DiffuseTexture = new ImageTextureInfo() { FilePath = @"I:\3D\Textures\Oxidated.jpg" },// { FilePath = @"I:\3D\Textures\102.png" },
                    //BumpTexture = new ImageTextureInfo() { FilePath = @"I:\3D\Textures\102bump.png" },
                    NormalMap = new ImageTextureInfo() { FilePath = @"I:\3D\Textures\Oxidated.normal.jpg" }
                };
            var secondMI = new MaterialInfo()
                {
                    Name = "smi",
                    DiffuseReflectance = new RgbSpectrum(0.75f),
                    SpecularReflectance = new RgbSpectrum(0.75f)
                };
            ObjectMaterial = new SurfaceMaterial
                (
                //new MatteMaterial(materialInfo.DiffuseReflectance) { MaterialData = materialInfo }
                new OrenNayarMaterial(materialInfo.DiffuseReflectance, 0.2f) { MaterialData = materialInfo }
                //new AnisotropicPhong(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance, 10f, 10f) { MaterialData = materialInfo}
                //new GlassMaterial(materialInfo.DiffuseReflectance + 0.2f, materialInfo.GlossReflectance + 0.2f, 1.0005f, 1.5f, true, true) { MaterialData = materialInfo }
                
                //new MetalMaterial(materialInfo.DiffuseReflectance, materialInfo.PhongExponent, true){MaterialData = materialInfo}
                /*
                 */

               // new MatteMirrorMaterial(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance, true) { MaterialData = materialInfo }
                // new ArchGlassMaterial(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance, true, true) { MaterialData = materialInfo}
                    
                /*
                new DistributionBsdf(10.175f, materialInfo.DiffuseReflectance
                    //,new FresnelDielectric(1.39f, 0.6f)
                    ,new FresnelConductor(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance)
                    ) {MaterialData = materialInfo} */
                //new MirrorMaterial(materialInfo.DiffuseReflectance, true) { MaterialData = materialInfo }
                //new MatteMaterial(secondMI.DiffuseReflectance) { MaterialData = secondMI }
                //new TranslucentMaterial(materialInfo.DiffuseReflectance) { MaterialData = secondMI }
                //new MatteMaterial(materialInfo.DiffuseReflectance){ MaterialData = materialInfo }
                /*
                new MatteMaterial(materialInfo.DiffuseReflectance){ MaterialData = materialInfo }
                 * 
                new MirrorMaterial(secondMI.DiffuseReflectance, true) { MaterialData = secondMI }*/
              //new AlloyMaterial(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance, materialInfo.PhongExponent, 0.5f, true) {MaterialData = materialInfo}
                    );

            var planeMI = new MaterialInfo()
                {
                    Name = "plane_material",
                    DiffuseReflectance = new RgbSpectrum(0.7f),
                    DiffuseTexture = new ImageTextureInfo() { FilePath = "Finishes.Flooring.Tile.Diamond.Red.jpg" },
                    //{ FilePath = @"I:\3D\Textures\CEDFENCE.jpg" },
                    //BumpTexture = new ImageTextureInfo() { FilePath = @"I:\3D\Textures\102bump.png" },
                    BumpMap = new ImageTextureInfo() { FilePath = "Finishes.Flooring.Tile.Diamond.Red.bump.jpg" }
                    
                    //{ FilePath = @"I:\3D\Textures\CEDFENCE.Normal.jpg" }

                };
            PlaneMaterial = new SurfaceMaterial(

                new MatteMaterial(planeMI.DiffuseReflectance) 

                // new DistributionBsdf(1.175f, materialInfo.DiffuseReflectance ,new FresnelDielectric(1.39f, 0.6f))
                { MaterialData = planeMI});

        }

    }
}
